package com.ss.android.article.base.feature.video;

import com.ss.android.common.callback.CallbackCenter;
import java.util.WeakHashMap;

public class DialogShowHelper {
    private static DialogShowHelper helper;
    private WeakHashMap mDialogMap;
    private int show;

    private DialogShowHelper() {
        this.show = 0;
        this.mDialogMap = new WeakHashMap();
    }

    public void addDialog(Object obj) {
        if(this.mDialogMap != null) {
            this.mDialogMap.put(obj, null);
        }
    }

    public static DialogShowHelper getInst() {
        if(DialogShowHelper.helper == null) {
            synchronized (DialogShowHelper.class){
                if(DialogShowHelper.helper == null) {
                    DialogShowHelper.helper = new DialogShowHelper();
                }
            }
        }
        return DialogShowHelper.helper;
    }

    public boolean isDlgShow() {
        return this.mDialogMap.size() != 0;
    }

    public void removeDialog(Object obj) {
        if(this.mDialogMap != null) {
            this.mDialogMap.remove(obj);
        }
        if(this.mDialogMap.size() == 0) {
            CallbackCenter.notifyCallback(IVideoController.RESHOW_END_COVER, new Object[0]);
        }
    }
}

